package NK_SEL.pages;

import static org.openqa.selenium.support.ui.ExpectedConditions.presenceOfElementLocated;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
//import org.openqa.selenium.support.ui.Select;

public class FilmAddPage extends InternalPage {

	public FilmAddPage(PageManager pages) {
		super(pages);
	}
	
  @FindBy(name = "name")
  private WebElement titleField;
	
  @FindBy(name = "year")
  private WebElement yearField;
  
  @FindBy(name = "submit")
  private WebElement saveButton;

  
  public String getTitle() {
    return titleField.getAttribute("value");
  }

  public FilmAddPage setTitleField(String text) {
    titleField.sendKeys(text);
    return this;
  }

  public String getYear() {
    return yearField.getAttribute("value");
  }
  
  public FilmAddPage setYearField(String text) {
	    yearField.sendKeys(text);
	    return this;
	  }

  public void clickSaveButton() {
	    saveButton.click();
	  }

  
  public FilmAddPage ensurePageLoaded() {
    super.ensurePageLoaded();
    /// wait.until(presenceOfElementLocated(By.cssSelector("input#Year")));
    //wait.until(presenceOfElementLocated(By.cssSelector("input#username")));
    //wait.until(presenceOfElementLocated(By.cssSelector("div.content h3")));
    return this;
  }

}
